package com.qf.mapper;

/*
 *  @author Administrator
 *  @version V1.0
 *  @Project smartdeviceplatgorm
 *  @Package com.qf.mapper
 *  @Description
 *  @Date2022/3/17 0017 10:52
 */

import com.qf.bean.SysUserOnline;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface SysUserOnlineMapper {
    @Insert("INSERT INTO sys_user_online values (#{sessionId},#{loginName},#{ipaddr},#{loginLocation},#{browser},#{os},#{status},#{startTimestamp},#{lastAccessTime},#{expireTime})")
    void addSysUserOnline(SysUserOnline sysUserOnline);


    @Select("SELECT COUNT(*) FROM sys_user_online WHERE login_name=#{loginName} ")
    int findByUserName(String loginName);

    @Update("UPDATE sys_user_online SET sessionId=#{sessionId},ipaddr=#{ipaddr},login_location=#{loginLocation},browser=#{browser},os=#{os},status=#{status},start_timestamp=#{startTimestamp},last_access_time=#{lastAccessTime},expire_time=#{expireTime} WHERE login_name=#{loginName}")
    void updateSysUserOnline(SysUserOnline sysUserOnline);
}
